/**
 * Created with JetBrains WebStorm.
 * User: zero7u
 * Date: 13-6-6
 * Time: 下午2:44
 * To change this template use File | Settings | File Templates.
 */

exports.has = function (array, item) {
  return array.indexOf(item) > -1;
};

/**
 * unique add
 * @param array
 * @param item
 * @returns {array.length}
 */
exports.uniquePush = function (array, item) {
  if (array.indexOf(item) == -1) {
    return array.push(item);
  } else {
    return 0;
  }
};

exports.remove = function (array, item) {
  for (var i = 0, n = array.length; i < n; i++) {
    if (array[i] == item) {
      array.splice(i, 1);
      break;
    }
  }
};